using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using GameForKids;

namespace GameFramework
{
    public abstract class ViewItem : DrawableGameComponent, IMoveable
    {
        protected Vector2 _position;
        public Vector2 Position
        {
            get
            {
                return _position;
            }
            set
            {
                _position = value;
                PositionChange(value);
            }
        }

    
        public object Tag;

        public Vector2 CenterItemPosition;
        public float ItemDistance;
        public int Index;

        public event EventHandler Selected;

        public virtual Rectangle GetBound()
        {
            return new Rectangle();
        }

        public ViewItem(Game game)
            : base(game)
        {

        }

        public virtual void PositionChange(Vector2 position)
        {

        }

        public virtual void HandleInput(GameTime gameTime, InputState input)
        {

        }

        public virtual float GetComputeCenterData()
        {
            return 0;
        }

        public virtual void Move(float dx, float dy)
        {
            _position.X += dx;
            _position.Y += dy;
            PositionChange(_position);
        }

        public virtual void OnItemSelected()
        {
            if (Selected != null)
                Selected(this, new EventArgs());
        }
    }
}
